/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sapra.main;


import caintra.Sapra.Pantalla.Dispersion.DispersionView;
import caintra.Sapra.Pantalla.Empresa.EmpresaView;
import caintra.Sapra.Pantalla.QuincenalMensual.PrefacturaMViewQM;
import caintra.Sapra.Pantalla.Prefactura.PrefacturaMView;
import echopointng.ContainerEx;
import echopointng.ContentPaneEx;
import echopointng.ExtentEx;
import echopointng.Menu;
import echopointng.MenuBar;
import echopointng.MenuItem;
import echopointng.layout.DisplayLayoutData;
import java.util.List;
/*import java.util.logging.Level;
import java.util.logging.Logger;*/
import javax.servlet.http.HttpSession;
import nextapp.echo2.app.Alignment;
import nextapp.echo2.app.Border;
import nextapp.echo2.app.Color;
import nextapp.echo2.app.Column;
import nextapp.echo2.app.ContentPane;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.FillImage;
import nextapp.echo2.app.Font;
import nextapp.echo2.app.ImageReference;
import nextapp.echo2.app.Insets;
import nextapp.echo2.app.Label;
import nextapp.echo2.app.ResourceImageReference;
import nextapp.echo2.app.Row;
import nextapp.echo2.app.SelectField;
import nextapp.echo2.app.SplitPane;
import nextapp.echo2.app.event.ActionEvent;
import nextapp.echo2.app.event.ActionListener;
import nextapp.echo2.app.list.DefaultListModel;
import nextapp.echo2.extras.app.MenuBarPane;
import nextapp.echo2.webcontainer.command.BrowserRedirectCommand;
import nextapp.echo2.webrender.WebRenderServlet;
import org.sapra.Prefactura.DisplayPane;
import org.sapra.Prefactura.migracionPrefactura3;
import org.sapra.abc.dEmpresa;
import org.sapra.abc.vCambioEmpresa;
import org.sapra.abc.vCarrera;
import org.sapra.abc.vCentroCosto;
import org.sapra.abc.vCorporativo;
import org.sapra.abc.vDepartamento;
import org.sapra.abc.vDireccion;
import org.sapra.abc.vGlobalSearch;
import org.sapra.abc.vGpoEmpresas;
import org.sapra.abc.vPracticante;
import org.sapra.abc.vUniversidad;
import org.sapra.abc.ReportePane;
import org.sapra.abc.vEmpresa;
import org.sapra.abc.vUsuario;
import org.sapra.dao.Empresa;
import org.sapra.echo.Helpers;
import org.sapra.echo.Styles;
import org.sapra.echo.wAviso;
import org.sapra.logon.dLogin;
import org.sapra.logon.wLogin;
import org.sapra.echo.Dispersion2.DispersionPane;



/**
 * Generated Echo form template
 * 
 * @author ppratsc
 */
public class vPrincipal extends ContentPaneEx {

    public vPrincipal() {
        super();
        initComponents();
    }
    private SelectField mSelEmpresa;
    private SplitPane mSplit;
    private ContentPane mWorkPane;
    private ContentPane mABCPane = null;
    private ContentPane mCCTPane = null;
    private ContentPane mDEPPane = null;
    private ContentPane mUserPane=null;
    private ContentPane mEMPPane = null;
    private ContentPane mDIRPane = null;
    private ContentPane mPrefactura=null;
    private ContentPane mCamEmp=null;
    private ContentPane mUnivPane=null;
    private ContentPane mGpoEmp=null;
    private ContentPane mCorporativo=null;
    private ContentPane mCarrera=null;
    private ContentPane mBusqueda=null;
    private ContentPane mDispersion=null;
    private ContentPane mReportes=null;
    private ContentPane mMain=null;
    private ContentPane mPrefactura2=null;
    static String DIR_IMAGEN="org/sapra/echo/image/";
    /*private  String dir1="org/sapra/echo/image/menu.png";
    private  String dir2="org/sapra/echo/image/boton_salir.png";*/
    ImageReference rf;

    private void initComponents() {

        //Textos Fijos
        ContainerEx conENG=Helpers.contenedor();
        conENG.setWidth(new ExtentEx(100,ExtentEx.PERCENT));
        conENG.setHeight(new ExtentEx(800,ExtentEx.PX));
        ContentPaneEx cpEx=new ContentPaneEx();
        DisplayLayoutData dld=Helpers.displaylayout();


        String sUsr = dLogin.getUser().getNombre() + " (" + dLogin.getUser().getLogin() + ")";
        //Split Principal
        HttpSession session = WebRenderServlet.getActiveConnection().getRequest().getSession();
        session.setAttribute("_empresa",dLogin.getEmpresa2((dLogin.getUser().getFk_empresaId())));
        mSplit = Helpers.SplitPanel(SplitPane.ORIENTATION_VERTICAL, new Extent(120,Extent.PX), false, cpEx);
        mSplit.setBackground(Color.WHITE);
        mSplit.setLayoutData(dld);
        //Header
        Column Col1 = Helpers.Column("Header", new Extent(5), mSplit);
        Row Row1 = Helpers.Row("Row1", new Extent(5), Col1);
        Row1.setAlignment(Alignment.ALIGN_CENTER);
        //LOGO
        Row1.add(new Label(Styles.SAPRA_LOGO2)); //LOGO
        //Campos
        Column Col2 = Helpers.Column("Titulos", new Extent(7), Row1);
        Label lemp = Helpers.Label("Empresa:", Color.BLACK, Col2);
        Label lusr = Helpers.Label("Usuario:", Color.BLACK, Col2);
        Label lsts = Helpers.Label("Status:", Color.BLACK, Col2);
        //Texto
        Column Col3 = Helpers.Column("Textos", new Extent(5), Row1);
        mSelEmpresa = Helpers.SelectField(Col3,new ActionListener(){public void actionPerformed(ActionEvent e) {CambioEmpresa(e);}});
        Label lusr2 = Helpers.Label(sUsr, Color.BLACK, Col3);
        Label lsts2 = Helpers.Label("STATUS", Color.BLACK, Col3);
        //Menu de Botones
        Row Row2 = Helpers.Row("Row2", new Extent(5), Col1);
        Row2.setAlignment(Alignment.ALIGN_CENTER);
        //Area de Trabajo
        mWorkPane = new ContentPane();
        //mWorkPane.setLayoutData(dsd);
        mWorkPane.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN + "fondo.jpg")));
        Row x=barraMenu();
        x.setAlignment(Alignment.ALIGN_CENTER);
        
        mWorkPane.add(x);
        mSplit.add(mWorkPane);
        add(cpEx);
        /*Column colEx=new Column();
        colEx.add(conENG);
        add(colEx);*/
        
        FirstTime();
        
    }

    public void FirstTime(){
        // Obtiene la Empresa por Default del Usuario
        Empresa empresa = dLogin.getEmpresa();

        if(empresa == null){
            // El usuario NO tiene asocidas empresas
            add(new wAviso("ERROR","¡EL USUARIO NO TIENE EMPRESAS ASOCIADAS!"));
            return;
        }

        List<Empresa> empresas = dPrincipal.getEmpresas(dLogin.getUser());
        mSelEmpresa.setModel( new DefaultListModel(empresas.toArray()));
        mSelEmpresa.setSelectedItem(new Empresa(empresa.getEmpresaId())); // Empresa Actual

        UpdateView();
    }
    public void UpdateView(){
        Empresa empresa = dLogin.getEmpresa();
        List<Empresa> empresas = dPrincipal.getEmpresas(dLogin.getUser());
        mSelEmpresa.setModel( new DefaultListModel(empresas.toArray()));
        mSelEmpresa.setSelectedItem(new Empresa(empresa.getEmpresaId()));
        return;

    }

    private void MenuPracticantes(ActionEvent evt){
        // Abre el Panel de Practicantes
        if(mABCPane == null){
            //La primera vez que se abre el Pane
            mWorkPane.removeAll();
            mABCPane = new vPracticante(this);
            mWorkPane.add(mABCPane);
            return;
        }

        mWorkPane.removeAll();
        mWorkPane.add(new vPracticante(this));
        
    }
    private void MenuCCosto(ActionEvent evt){
        if(mCCTPane == null){
            //La primera vez que se abre el Pane
            mWorkPane.removeAll();
            mCCTPane = new vCentroCosto(this);
            mWorkPane.add(mCCTPane);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vCentroCosto(this));
    }
    private void MenuEmpresa(ActionEvent evt){
        if(mEMPPane == null){
            //La Primera vez que se abre el Pane
            mWorkPane.removeAll();
            mEMPPane = new vEmpresa(this);
            mWorkPane.add(mEMPPane);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vEmpresa(this));
    }

    private void MenuDireccion(ActionEvent evt){
        if(mDIRPane == null){
            //La Primera vez que se abre el Pane
            mWorkPane.removeAll();
            mDIRPane = new vDireccion(this);
            mWorkPane.add(mDIRPane);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vDireccion(this));
    }

    private void MenuDeptos(ActionEvent evt){
        if(mDEPPane == null){
            //La primera vez que se abre el Pane
            mWorkPane.removeAll();
            mDEPPane = new vDepartamento(this);
            mWorkPane.add(mDEPPane);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vDepartamento(this));

    }
    private DisplayPane ds=null;
    private void Prefactura(ActionEvent evt){
        Empresa empresa = dLogin.getEmpresa();
        if(mPrefactura==null){
            ds=new DisplayPane(this);
            mPrefactura=ds;
            mWorkPane.removeAll();
            mWorkPane.add(ds);
            return;
        }else{
            if(ds.getPdb()!=null){
                ds.getPdb().close();
                ds.setPdb(null);
            }
            
            ds=new DisplayPane(this);
            mPrefactura=ds;
            mWorkPane.removeAll();
            mWorkPane.add(ds);
        }

    }
    private void Prefactura2(ActionEvent evt){
        /*migracionPrefactura3 m3=new migracionPrefactura3();
        m3.fix();
        m3.copia_datos();*/

        Empresa empresa = dLogin.getEmpresa();
        if(mPrefactura==null){
            mWorkPane.removeAll();
            mWorkPane.add(new PrefacturaMView(empresa.getEmpresaId(),dLogin.getUser().getUsuarioId(),this));
            return;
        }else{
            if(ds.getPdb()!=null){
                ds.getPdb().close();
                ds.setPdb(null);
            }

            mWorkPane.removeAll();
            mWorkPane.add(new PrefacturaMView(empresa.getEmpresaId(),dLogin.getUser().getUsuarioId(),this));
        }

    }

      private void QuincenalMensual(ActionEvent evt){
        Empresa empresa = dLogin.getEmpresa();
        if(mPrefactura2==null){
            mWorkPane.removeAll();
            mWorkPane.add(new PrefacturaMViewQM(empresa.getEmpresaId(),dLogin.getUser().getUsuarioId(),this));
            return;
        }else{
            if(ds.getPdb()!=null){
                ds.getPdb().close();
                ds.setPdb(null);
            }

            mWorkPane.removeAll();
            mWorkPane.add(new PrefacturaMViewQM(empresa.getEmpresaId(),dLogin.getUser().getUsuarioId(),this));
        }

    }

    private void Dispersion2(ActionEvent evt){
        //migracionPrefactura3 mig=new migracionPrefactura3();
        //mig.fix();
        //mig.copia_datos();
        try {
            if(mDispersion == null){
            mWorkPane.removeAll();
            mDispersion = new DispersionView(this);
            mWorkPane.add(mDispersion);
            return;
            }
            mWorkPane.removeAll();
            mWorkPane.add(new DispersionView(this));
        } catch (Exception e) {
        }

    }
    private void Dispersion(ActionEvent evt){
        //migracionPrefactura3 mig=new migracionPrefactura3();
        //mig.fix();
        //mig.sincroniza_Movimientos();
        if(mDispersion == null){
            mWorkPane.removeAll();
            mDispersion = new DispersionPane(this);
            mWorkPane.add(mDispersion);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new DispersionPane(this));

    }

    private void MenuUsuarios(ActionEvent evt){
        if(mUserPane == null){
            //La primera vez que se abre el Pane
            mWorkPane.removeAll();
            mUserPane = new vUsuario(this);
            mWorkPane.add(mUserPane);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vUsuario(this));

    }
    private void MenuCambioEmp(ActionEvent evt){
        if(mCamEmp==null){
            mWorkPane.removeAll();
            mCamEmp = new vCambioEmpresa(this);
            mWorkPane.add(mCamEmp);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vCambioEmpresa(this));
    }
    private void MenuMain(ActionEvent evt){
        ContentPane cp=new ContentPane();
        //cp.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN + "fondo.png")));
        Row x=barraMenu();
        x.setAlignment(Alignment.ALIGN_CENTER);
        cp.add(x);
        if(mMain==null){
            mMain=cp;
        }
        mWorkPane.removeAll();
        mWorkPane.add(cp);
    }


    private void CambioEmpresa(ActionEvent evt){
        if(mSelEmpresa.getSelectedIndex()>=-1){
            dLogin.setEmpresa((Empresa)mSelEmpresa.getSelectedItem());
            Empresa emp=new Empresa();
            emp=dEmpresa.SelEmp(dLogin.getEmpresa().getEmpresaId());
            if(emp!=null)
                dLogin.setEmpresa(emp);

            ClearWorkPane();
            //UpdateView();
            //mWorkPane = new ContentPane();

            //mWorkPane.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN + "fondo.jpg")));
            Row x=barraMenu();
            x.setAlignment(Alignment.ALIGN_CENTER);
            mWorkPane.add(x);
        }
    }

     private void MenuUniversidad(ActionEvent evt){
        if(mUnivPane == null){
            //La Primera vez que se abre el Pane
            mUnivPane = new vUniversidad(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vUniversidad(this));
    }
      private void MenuGpoEmpresas(ActionEvent evt){
        if(mGpoEmp == null){
            //La Primera vez que se abre el Pane
            mGpoEmp = new vGpoEmpresas(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vGpoEmpresas(this));
    }
      private void MenuCorporativo(ActionEvent evt){
        if(mCorporativo == null){
            //La Primera vez que se abre el Pane
            mCorporativo = new vCorporativo(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vCorporativo(this));
    }
    private void MenuBusqueda(){
        if(mBusqueda==null){
            mWorkPane.removeAll();
            mBusqueda = new vGlobalSearch(this);
            mWorkPane.add(mBusqueda);
            return;
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vGlobalSearch(this));

    }
     private void MenuCarrera(ActionEvent evt){
        if(mCarrera == null){
            //La Primera vez que se abre el Pane
            mCarrera = new vCarrera(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new vCarrera(this));
    }
      private DispersionPane ds2=null;

  /*    private void MenuDispersion(ActionEvent evt){
        if(mDispersion == null){
            mDispersion = new DispersionPane(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new DispersionPane(this));

          if(mDispersion==null){
            ds2=new DispersionPane(this);
            mDispersion=ds2;
            mWorkPane.removeAll();
            mWorkPane.add(mDispersion);
            return;
        }

            ds2=new DispersionPane(this);
            mDispersion=ds2;
            mWorkPane.removeAll();
            mWorkPane.add(mDispersion);
        }
*/
    //}

    private void MenuReportes(ActionEvent evt){
        if(mReportes == null){
            //La Primera vez que se abre el Pane
            mReportes = new ReportePane(this);
        }
        mWorkPane.removeAll();
        mWorkPane.add(new ReportePane(this));
    }

    private void ClearWorkPane(){
        mWorkPane.removeAll();
        mABCPane = mCCTPane = mDEPPane = mEMPPane = mDIRPane = mCamEmp = mUserPane=mPrefactura=mPrefactura2=mBusqueda=mUnivPane=mGpoEmp= mCorporativo= mCarrera= mDispersion= null;
    }

     Row barraMenu(){

        menu=new Row();
        //Button bt1 = Helpers.Button("PRACTICANTES",Row2,new ActionListener(){public void actionPerformed(ActionEvent evt){MenuPracticantes(evt);}});
        MenuBarPane mbp=new MenuBarPane();
        MenuBar mb=new MenuBar();
        Menu menuPrin=new Menu("Menu");
        //menuPrin.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN+"boton.png")));
        //rf=new ResourceImageReference(dir1);
        //menuPrin.setIcon(rf);
        //menuPrin.setBorder(new Border(0,Color.BLACK,0));
        menuPrin.setAlignment(Alignment.ALIGN_CENTER);
        menuPrin.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){MenuMain(evt);}});
        mb.add(menuPrin);
        Menu filemenu=Helpers.estiloMenu("CATALOGO");
        filemenu.setWidth(new Extent(115));
        MenuItem emp=Helpers.menuItem("EMPRESA",new ActionListener(){public void actionPerformed(ActionEvent evt){

                    MenuEmpresa(evt);
}});
        MenuItem dir=Helpers.menuItem("DIRECCION",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuDireccion(evt);}});
        MenuItem users=Helpers.menuItem("USUARIOS",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuUsuarios(evt);}});
        MenuItem ccosto=Helpers.menuItem("CCOSTO",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuCCosto(evt);}});
        MenuItem depto=Helpers.menuItem("DEPTOS",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuDeptos(evt);}});
        MenuItem cambio=Helpers.menuItem("CAMBIO DE EMPRESA",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuCambioEmp(evt);}});
        MenuItem universidad=Helpers.menuItem("UNIVERSIDAD",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuUniversidad(evt);}});
        MenuItem gpo_empresas=Helpers.menuItem("GPO EMPRESAS",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuGpoEmpresas(evt);}});
        MenuItem corporativo=Helpers.menuItem("CORPORATIVO",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuCorporativo(evt);}});
        MenuItem carrera=Helpers.menuItem("CARRERA",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuCarrera(evt);}});
        MenuItem Busqueda=Helpers.menuItem("BUSQUEDA PRACT",new ActionListener(){public void actionPerformed(ActionEvent evt){MenuBusqueda();}});

        if(dLogin.getUser().getTipoUsuario().toLowerCase().equals("a")){
            filemenu.add(emp);
            filemenu.add(dir);
            filemenu.add(users);
            filemenu.add(universidad);
            filemenu.add(gpo_empresas);
            filemenu.add(corporativo);
            filemenu.add(carrera);
            Busqueda.setFont(new Font(Font.ARIAL, 1, new Extent(9)));
            filemenu.add(Busqueda);
            if(dLogin.getUser().getTipoUsuario().trim().equals("A")){
             cambio.setFont(new Font(Font.ARIAL, 1, new Extent(9)));
            filemenu.add(cambio);
        }
            mb.add(filemenu);
        }
        //Menu filemenuAju=new Menu("AJUSTES DE EMPRESA");
        Menu filemenuAju=Helpers.estiloMenu("AJUSTES DE EMPRESA");
        filemenuAju.add(ccosto);
        filemenuAju.add(depto);
        /*if(dLogin.getUser().getTipoUsuario().trim().equals("A")){
            filemenuAju.add(cambio);
        }*/
        mb.add(filemenuAju);

        //Menu filemenu2=new Menu("PRACTICANTES");
        Menu filemenu2=Helpers.estiloMenu("PRACTICANTES");
        filemenu2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){MenuPracticantes(evt);}});
        mb.add(filemenu2);

       

        Menu filemenu3=Helpers.estiloMenu("PREFACTURACION");

        if (dLogin.getEmpresa().getFk_esquemaPagoPracticanteId() == 10) {
                 filemenu3.addActionListener(new ActionListener() {

                     public void actionPerformed(ActionEvent evt) {
                         QuincenalMensual(evt);
                     }
                 });

             } else {
                 filemenu3.addActionListener(new ActionListener() {

                     public void actionPerformed(ActionEvent evt) {
                         Prefactura2(evt);
                     }
                 });
             }
         /*
          if (dLogin.getUser().getTipoUsuario().toLowerCase().equals("a") || dLogin.getUser().getTipoUsuario().toLowerCase().equals("e")
         || dLogin.getUser().getTipoUsuario().toLowerCase().equals("c")
         ) {
             Menu filemenu3 = Helpers.estiloMenu("PREFACTURACION");
             if (dLogin.getEmpresa().getFk_esquemaPagoPracticanteId() == 10) {
                 filemenu3.addActionListener(new ActionListener() {

                     public void actionPerformed(ActionEvent evt) {
                         QuincenalMensual(evt);
                     }
                 });

             } else {
                 filemenu3.addActionListener(new ActionListener() {

                     public void actionPerformed(ActionEvent evt) {
                         Prefactura2(evt);
                     }
                 });
             }
             mb.add(filemenu3);
         }

          */
        mb.add(filemenu3);

        if(dLogin.getUser().getTipoUsuario().toLowerCase().equals("a")){
                    //Menu filemenu4=new Menu("DISPERSION");
                    /*Menu filemenu4=Helpers.estiloMenu("DISPERSION");
                    filemenu4.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){Dispersion(evt);}});
                    mb.add(filemenu4);*/
                     /*Menu filemenu7=Helpers.estiloMenu("PREFACTURACION");
                    filemenu7.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){Prefactura2(evt);}});
                    mb.add(filemenu7);*/
                    
                    
                     /*if(dLogin.getEmpresa().getFk_esquemaPagoPracticanteId()==10){
                                Menu filemenu6=Helpers.estiloMenu("QUINCENAL MENSUAL");
                                 filemenu6.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){QuincenalMensual(evt);}});
                                 mb.add(filemenu6);}else{

                    }*/
                    Menu filemenu8=Helpers.estiloMenu("DISPERSION");
                    filemenu8.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){Dispersion2(evt);}});
                    mb.add(filemenu8);
                
        }
        //Menu filemenu5=new Menu("REPORTES");
        Menu filemenu5=Helpers.estiloMenu("REPORTES");
        filemenu5.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent evt){MenuReportes(evt);}});
        mb.add(filemenu5);

        Menu filemenuSalir=new Menu("SALIR");
        /*rf=new ResourceImageReference(dir2);
        filemenuSalir.setIcon(rf);
        filemenuSalir.setBorder(new Border(0,Color.BLACK,0));*/
        filemenuSalir.setBackground(Color.RED);
        filemenuSalir.setForeground(Color.WHITE);
        filemenuSalir.setForeground(Color.WHITE);
        filemenuSalir.setFont(new Font(Font.ARIAL, 1, new Extent(14)));
        filemenuSalir.setRolloverForeground(Color.BLACK);
        filemenuSalir.setRolloverBackground(new Color(235,235,0));
        filemenuSalir.setBorder(new Border(3,Color.BLACK, 3));
        filemenuSalir.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN+"fondo_salir.jpg")));
        filemenuSalir.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                 //ZapraxApp.getActive().enqueueCommand(new BrowserRedirectCommand("http://www.administraciondepracticantes.com:8080/Zaprax/"));
                 ZapraxApp.getActive().enqueueCommand(new BrowserRedirectCommand("http://www.administraciondepracticantes.com/Zaprax/"));
                 //ZapraxApp.getActive().enqueueCommand(new BrowserRedirectCommand("http://localhost:8084/Zaprax/"));
                 HttpSession session = WebRenderServlet.getActiveConnection().getRequest().getSession();
                 session.removeAttribute("_empresa");
                 session.removeAttribute("_usuario");
                 ContentPane pn1=new ContentPane();
                 pn1.add(new wLogin());
                 ZapraxApp.getActive().getDefaultWindow().setContent(pn1);
            }
        });
        mb.add(filemenuSalir);
        mb.setWidth(new Extent(900));
        mb.setHeight(new Extent(30));
        mb.setInsets(new Insets(new Extent(7)));
        //mb.setBorder(new Border(5,Color.BLUE, 2));
        //mb.setBackground(new Color(180,190,255));
        menu.add(mb);

        return menu;
    }
     private Row menu;

    public Row getMenu() {
        return menu;
    }

    public void setMenu(Row menu) {
        this.menu = menu;
    }
     
}

